import { request } from "../../request/index.js"

Page({
  data:{
        code:''
  },
 async handleGetUserInfo(e) {
// console.log(e);
    const{ encryptedData,rawData,iv,signature} = e.detail
      // 获得登录后的code值
        wx.login({
          timeout:10000,
          success: (result) => {
            // console.log(result);
            this.setData({
              code:result.code
            })
          }
        });
     const {code} =this.data
    console.log(code);
    
    const loginParams = {encryptedData,rawData,iv,signature,code}
    // 发送请求 获取用户token值
    const res =  await request({
      url:"https://api-hmugo-web.itheima.net/api/public/v1/users/wxlogin",
      data:loginParams,
      method:"post"
    })
    console.log(res);

  }
})